define([],function(){
    var serialize = function(v){
        if(typeof v == "object"){
            return JSON.stringify(v);
        } 
        return v;
    };
    var unserialize = function(v){ 
        return JSON.parse(v);
    };
    var _set = function(k,v){
        var val = serialize(v);
        localStorage.setItem(k,val);
        return v;
    };
    var _get = function(k){
        var v = localStorage.getItem(k);
        return unserialize(v);
    };
    return {
        set:_set,
        get:_get
    };
});